Fixed minor errors in interpreter, parser and javascript converter

Mainly to do with casts /instanceof not working correctly, and equality not working correctly in some edge cases.