Changed over to use logging and fixed bug in storing userpics