Fixed some bugs together with Alexz