fixed nil pattern errors