Removed inconsistent login. Used OAuth instead. Added a new form, and all is looking fine.
Added a method to validate directory/file names to avoid invalid character exception.