nil errors fixed