fixed some errors while running on mono
needs more work