Top hat master 6.4.4.unix target fixes

With this small patches I have make TARGET=UNIX working.

I haven't tested TARGET=ANDROID7 but the patches look like it should work.