Fixed logic errors
Merge remote-tracking branch 'origin/master'