Genral fixes, probably good enough for 0.0.1 release