now works in simulator