fixed NullPointer exception
changes to behaviour and added fixes to some stuff
Merge remote-tracking branch 'upstream/master'
Merge remote-tracking branch 'upstream/master'