PLEASE change chmod and mkdir permissions to 0750 (leading zero for octal representation) , it is currently as 750 so linux messes things up when you want to rmdir and all file permissions are also incorrect.
http://php.net/manual/en/function.chmod.php
(I wanted to branch and commit to that branch changes but couldn't ,wasted so much time on two missing 0, but further great library thanks)