fixed nullPointer at level end