Fix #502
Fix #487
Fix #490