Error check fixed

I also got rid of import java.math, uncomment if needed.