fix null exception for 'when' decorator