fix calculator bugs