fixed obvious null-reference bug