Fixed write according to #144 of original sorl-thumbnail