synced with commit https://github.com/BlueSpire/Durandal/commit/010f7d2c57e49a2b0a0f9a3fdf17e289080fe5be