fixed many Java 8 compatibility issues