made it compile, almost works, i hope.
Fixed an exception