fixed bug with layers