Improved screenshot rake task logic