Some bugfixes and built script for netbsd