Fixed queue based scheduler to make it work properly