Fixed some small bugs

see commits