Fixes sequence generation bug