Fixes for potential if statement errors
Fixed some weird code