Fixed bug in simulating data