fix types for ARM support; fix errno handling; minor fixes; license GPL3 or later fix