fixing null errors