Debugging issue of nilclass