fixed some bugs that Sebastian Zarnekow pointed out