Fix for #372

Checks for events before attaching 'ready' listener when adding a layer.