fix nullpointer at corner