Fix build on Haiku

So, first, doing things same way as on any other POSIX platform
(os.chmod) doesn't work on Haiku, so I got around it in the most simple
way. Also, I've fixed procedure for joining files (I made a huge and
obvious mistake *facepalm*). Anyway, it builds! ^^
Post-cleanup fixes

Changed name of "putin" procedure to "putIn" and I guess I've left some
remains here, I hope it works now.