fix bug#412

I've fixed bug#412.
Please review it, and accept it if you can.