On Joris' theorem on differentiability of functions