fixes, compilation works at least
reverted to upstream