Fixing if condition
Checking for invalid duplicate polygon points
Possible Lua handling fix