fixed bug 516 (decrement nullpointerexception)