Fix end() error. Added checks for processor