fixed null exception, added rules