Fixing compilation errors and redundant checks