fixed NoneType syntax error