fix NoClassDefFoundError bug and avoid crash in 1.7