fix arraylength
add missing null pointer check in athrow
add more tests